/**
 * 
 */
package com.taobao.snowsnow.util;

import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
 * @author Tux
 *
 * 创建时间: 2011-4-29 上午09:32:18
 */
public class ApplicationContextUtil {
//	private static ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[]{"debug_applicationContext-hibernate.xml", "applicationContext-hibernate-dao.xml", "applicationContext-service.xml"});
//	private static ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:/applicationContext-*.xml");
//	private static ApplicationContext ctx = new FileSystemXmlApplicationContext("classpath:applicationContext-*.xml");
	private static ApplicationContext ctx = new FileSystemXmlApplicationContext(new String[]{"classpath:applicationContext-hibernate-dao.xml", "classpath:applicationContext-hibernate.xml", "classpath:applicationContext-hibernate-service.xml"});

	public static ApplicationContext getContext() {
		return ctx;
	}
	
	public static Object getBean(String id) throws NoSuchBeanDefinitionException {
		return ctx.getBean(id);
	}
}
